var checkFlg = false;
var parentFuncId = "";
/**
* 初使化窗口时，取得父窗口的相关参数
*/
function onLoad() {
	parentFuncId = document.getElementById("parentId").value;
	if(parentFuncId != ""){
		var moreFunctionId = parent.treePage.document.getElementById("CHECK_"+parentFuncId).value;
		var lastIndex = moreFunctionId.lastIndexOf(';');
		if(lastIndex != -1){
			var newStr = moreFunctionId.substring(0,moreFunctionId.lastIndexOf(';'));
			var checkAry = newStr.split(';');
			for(var i=0;i<checkAry.length;i++){
				if(parentFuncId != checkAry[i]){
					document.getElementById(checkAry[i]).checked 
						= parent.treePage.document.getElementById("CHECK_"+parentFuncId).checked;
				}		
			}
		}
		checkFlg = true;	
	}
}

/**
* 提交FORM
* @param	linkType	要执行的操作关键词
*/
function submitButton(linkType) {
	document.all.functionName.value = linkType;
	document.all.actForm.submit();
}

//选中子模块下面的所有元素
function subOnClickCheckAll(flg) {
	var checkAry = document.getElementsByName("checkBox");
	if(checkAry.length > 0){
		for(var i = 0;i < checkAry.length;i++){
			checkAry[i].checked = flg;
		}	
	}
	if(parentFuncId != "" && flg == true){
		parent.treePage.document.getElementById("CHECK_"+parentFuncId).checked = flg;	
	}
}

function checkOne(obj){
	var checkedFlg = false;
	var checkAry = document.getElementsByName("checkBox");
	if(checkAry != null || checkAry.length > 0){
		for(var i = 0;i<checkAry.length;i++){
			if(checkAry[i].checked){
				checkedFlg = true;
				break;
			}
			
		}
		if(!parent.treePage.document.getElementById("CHECK_"+parentFuncId).checked){
			
			parent.treePage.document.getElementById("CHECK_"+parentFuncId).checked = checkedFlg;
		}
	}	
}



